package com.summer.study.leetcode.algorithm;

import com.summer.study.leetcode.tree.BinaryTree;
import com.summer.study.leetcode.tree.Tree;
import com.summer.study.leetcode.tree.TreeUtil;

/**
 * @auther: 杨杰
 * @date: 2019/7/31 10:36
 * @description: 二叉树的最大深度
 * https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/
 */
public class Demo111 {

    public static void main(String[] args) {
        Tree<Integer> tree = new BinaryTree<>();
        TreeUtil.createIntegerTreeNodes(tree);
        System.out.println(tree.depth(false));
    }

    /*
    public int minDepth(TreeNode root) {
        if(root==null){
            return 0;
        }
        int left=minDepth(root.left);
        int right=minDepth(root.right);
        return (left==0||right==0)?left+right+1:Math.min(left,right)+1;
    }
    */

}
